package com.itheima.sc.impl.pms;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sc.api.pms.MemberPriceApi;
import com.itheima.sc.mapper.pms.MemberPriceMapper;
import com.itheima.sc.pojo.pms.MemberPrice;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;

@DubboService
public class MemberPriceImpl extends ServiceImpl<MemberPriceMapper,MemberPrice> implements MemberPriceApi {
    @Override
    public List<MemberPrice> getByPid(Integer pid) {
        LambdaQueryWrapper<MemberPrice> wrapper = new LambdaQueryWrapper<MemberPrice>().eq(MemberPrice::getProductId, pid);
        List<MemberPrice> memberPriceList = list(wrapper);
        return memberPriceList;
    }

    @Override
    public void removeByPid(Integer pid) {
        LambdaQueryWrapper<MemberPrice> wrapper = new LambdaQueryWrapper<MemberPrice>().eq(MemberPrice::getProductId, pid);
        remove(wrapper);
    }
}
